#ifndef BUSINESS_H
#define BUSINESS_H
#include<QStackedWidget>
#include <QWidget>
#include<QtCore/QObject>
#include "widget.h"
#include"poco/saleBase.h"
#include<vector>
#include"client.h"
#include"controller/windowcontroller.h"
#include"controller/merchantcontroller.h"
using std::vector;
struct order_info{
    QString name;
    int num;
};
namespace Ui {
class business;
}

class business : public QWidget
{
    Q_OBJECT

public:
     business(QWidget *parent = nullptr);
    ~business();
    void new_win_choose();
    //用户名称
    int id;
    //用户姓名
    QString name;
    //密码
    QString passwd;

    User user;
    vector<order_info*> orderinfo;
//    client * client;
    //菜单
    vector<SaleBase*> foods;
    //显示当前可点餐的菜品
    QStringList dish_name;
    QStringList dish_type;
    QStringList dish_price;
    vector<QPixmap> dish_picture;
    QStringList dish_unit;
    QStringList dish_description;
    void show_dish();
    //申请窗口
    QStringList cur_window;
    QStringList apply_window;
    QStringList window_name;
    //组织名称
    QStringList cur_organ;
    QStringList apply_organ;
    //设置用户信息
    void set_inform(QString id,QString name);
    //输出当前窗口信息
    void cur_window_show();
     void cur_window_show1();
     //输出组织
     void cur_organ_show();
     void cur_organ_show1();

     QTableWidget *table;
     QWidget *widget;

     vector<SaleBase*> _sale_vec;

     vector<int> dish_status;

     vector<WindowInfo> _win_info_list;

     vector<WindowInfo> vct_win_alpply;

     vector<OrganizationInfo> vct_org_apply;


    //界面
    virtual void keyPressEvent(QKeyEvent *event);
private slots:
    void on_open_Button_clicked();

    void on_add_dish_Button_clicked();

    void on_add_window_Button_clicked();

    void on_join_Button_clicked();
    //选择窗口槽函数
//    void window_clicked(QWidget *widget,QTableWidget *table);
void window_clicked();
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();
    void slotbuttonClicked();
    void slotbuttonClicked1();

    void on_dingingType_activated(int index);

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_submid_clicked();

    void on_join_Button_2_clicked();

    void on_pushButton_5_clicked();
    void order_show();


    void dish_cancel_clicked();

private:
    Ui::business *ui;

    MerchantController merCon;
    WindowController winCon;
    WindowInfo cur_win_info; //当前打开的窗口info （在打开窗口中选择的）

public:
    void setMerchantController(MerchantController& merCon)
    {
        this->merCon=merCon;
    }
public slots:
    void showOrder_detail();

};

#endif // BUSINESS_H
